package dfbz.数组排序;

public class Test03 {
    public static void main(String[] args) {
        int[] arr={2,0,33,7,2,0,83,0,62,5};
        int[] newArr=new int[arr.length];
        int[] ints = splice1(arr, newArr);
        System.out.println(ints);
        for (int i = 0; i <newArr.length ; i++) {
            System.out.print(newArr[i]+" ");
        }
    }

    private static int[]  splice1(int[] arr, int[] newArr) {
        int index=0;
        for (int i = 0; i <arr.length ; i++) {
            boolean flag=true;//假设当前的比较元素是不重复
            for (int j = 0; j <newArr.length ; j++) {
                if(newArr[j]==arr[i]){
                    flag=false;
                    break;
                }
            }
            if(flag==true){
                newArr[index]=arr[i];
                index++;
            }
        }
        return newArr;
    }
}
